<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initialscale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title>Document</title>
</head>

<body>
  <div id="app">
    <!-- v-on 指令绑定事件，click指定绑定的事件类型，事件发生时调用vue中methods节点中定义的方法 -->
    <input type="text" v-model="searchMap.keyWord">
    <!-- <button v-on:click="search()">查询</button> -->
    <!-- v-on 指令的简写形式 @ -->
    <button @click="search()">查询</button>
    <p>您要查询的是：{{searchMap.keyWord}}</p>
    <p><a v-bind:href="result.site" target="_blank">{{result.title}}</a></p>
  </div>
  <script src="vue.min.js"></script>
  <script>
    new Vue({
      el: '#app',
      data: {
        searchMap: {
          keyWord: '尚硅谷'
        },
        //查询结果
        result: {}
      },
      methods: {
        search() {
          console.log('search')
          this.result = {
            "title": "尚硅谷",
            "site": "http://www.atguigu.com"
          }
        }
      }
    })
  </script>
</body>

</html>